<!--
  @Descripttion:：简历编辑
  @Author：yejianbo
  @Date：2022年05月22日 03:06:59
-->
<template>
  <div>
     <PageCom class="showview">
      <section class="resume-review">
        <div class="nav-com">
          <el-breadcrumb
            separator-class="el-icon-arrow-right"
            style="margin-bottom: 20px"
          >
            <el-breadcrumb-item :to="{ name: 'home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ name: 'userCenter' }">
              用户中心
            </el-breadcrumb-item>
            <el-breadcrumb-item>
              <span style="color: #3d6cb0">{{ $route.meta.title || "--" }}</span>
            </el-breadcrumb-item>
          </el-breadcrumb>
        </div>
        <div
          style="
            height: 36px;
            font-size: 25px;
            font-family: PingFangSC-Semibold, PingFang SC;
            font-weight: 600;
            color: #37383d;
            line-height: 36px;
            margin-bottom: 27px;
          "
        >
          我的简历
        </div>
        <el-form ref="form" label-width="150px" label-position="left">
          <!-- 联系方式 -->
          <section class="block pt30">
            <div class="title">
              联系方式 <span class="en">Contact Information</span>
            </div>
            <div class="contact">
              <el-row>
                <el-col :span="17" :offset="7">
                  <div class="row1">
                    <span>手机号码</span>
                    <span>{{ userInfo.mobile }}</span>
                  </div>
                </el-col>
                <el-col :span="17" :offset="7">
                  <div class="row1">
                    <span>邮箱地址</span>
                    <span>{{ userInfo.email }}</span>
                  </div>
                </el-col>
              </el-row>
            </div>
          </section>
          <!-- 个人信息 -->
          <section class="block pt30">
            <div class="title">
              个人信息 <span class="en">Personal Information</span>
              <div class="edit-btn" type="text" @click="linkTo('userInfo')">
                <i class="edit-icon"></i> 编辑
              </div>
            </div>
            <div class="user-info">
              <img
                class="touxiang"
                v-if="userInfo.studentPictureUrl"
                :src="userInfo.studentPictureUrl"
                alt="用户头像"
              />
              <img
                class="touxiang"
                v-else
                src="../../assets/images/touxiang1.png"
                alt="用户头像"
              />
              <div class="row1">{{ userInfo.nickname }}</div>
              <div class="row2">
                {{ userInfo.sex }}<span class="line"></span>{{ userInfo.age
                }}<span class="line"></span>{{ userInfo.liveCity
}}<span class="line"></span>{{ userInfo.clan
}}<span class="line"></span>{{ userInfo.political }}
              </div>
            </div>
          </section>
          <!-- 求职状态 -->
          <section class="block pt30">
            <div class="title">
              求职状态 <span class="isRequire">*必填</span
              ><span class="en">Job Status</span>
              <div
                class="add-btn"
                @click="openJobStatusEdit"
                v-if="!jobStatusFlag"
              >
                编辑
              </div>
            </div>
            <div class="job-wish-item" v-if="!jobStatusFlag">
              <div class="row1">
                {{
                  (userInfo.jobStatus || "--") +
                  "/" +
                  (userInfo.inJobTime || "--")
                }}
              </div>
            </div>
            <div class="" v-if="jobStatusFlag">
              <el-form
                ref="jobStatusRef"
                :model="jobStatusFrom"
                label-position="left"
                label-width="150px"
              >
                <el-form-item label="当前状态" required>
                  <span slot="label" class="left-label">
                    <span calss="cn-label">当前状态</span><br />
                    <span class="en-label">Current State</span>
                  </span>
                  <SelectCom
                    :options="[
                      { label: '正在实习', value: '正在实习' },
                      { label: '暂无实习', value: '暂无实习' },
                    ]"
                    v-model="jobStatusFrom.jobStatus"
                  />
                </el-form-item>
                <el-form-item label="入职时间" required>
                  <span slot="label" class="left-label">
                    <span calss="cn-label">入职时间</span><br />
                    <span class="en-label">Entry Time</span>
                  </span>
                  <SelectCom
                    :options="[
                      { label: '随时入职', value: '随时入职' },
                      { label: '2周内入职', value: '2周内入职' },
                      { label: '时间待定', value: '时间待定' },
                    ]"
                    v-model="jobStatusFrom.inJobTime"
                  />
                </el-form-item>
                <el-form-item label=" ">
                  <el-button @click="editJobStatus">取消</el-button>
                  <el-button type="primary" @click="submitJobStatus"
                    >确定</el-button
                  >
                </el-form-item>
              </el-form>
            </div>
          </section>
          <!-- 模板名称 -->
          <section class="block pt30">
            <div class="title">
              简历名称 <span class="isRequire">*必填</span
              ><span class="en">Resume Name</span>
            </div>
            <el-input
              v-model="name"
              placeholder="请输入简历名称"
              maxlength="20"
              style="width: 180px"
            ></el-input>
          </section>
          <!-- 求职/实习意向 -->
        <section class="block pt30">
          <div class="title">
            求职/实习意向 <span class="isRequire">*必填</span
            ><span class="en">Job Preferences</span>
            <!-- <div
              class="add-btn"
                @click="editFun('internshipDesire')"
                v-if="!internshipDesireFlag && internshipDesire.length > 0"
              >
                + 添加求职意向
              </div> -->
            </div>
            <div
              class="empty-btn"
              @click="editFun('internshipDesire')"
              v-if="internshipDesire.length <= 0 && !internshipDesireFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加求职意向 </el-col>
              </el-row>
            </div>
            <div
              class="job-wish-item"
              v-for="(item, index) in internshipDesire"
              :key="index"
              v-if="!internshipDesireFlag"
            >
              <div class="row1">{{ item.jobName }}</div>
              <div class="row4">
                <div class="row4_flex">
                  <span class="label">薪资要求：</span
                  ><span class="value"
                    >{{ item.lowestSalary }}-{{ item.highestSalary }}元</span
                  >
                </div>
                <div class="row4_flex">
                  <span class="label">期望城市：</span
                  ><span class="value">{{ item.targetCity }}</span>
                </div>
              </div>
              <div class="row4">
                <span class="label">期望行业：</span>
                <span class="value">
                  {{ Array.isArray(item.expectedIndustry[0]) && item.expectedIndustry[0].length === 2 ? item.expectedIndustry[0].join('-') : '--' }}
                </span>
              </div>
              <div
                class="edit-btn top0"
                type="text"
                @click="editFun('internshipDesire', item, index)"
              >
                <i class="edit-icon"></i> 编辑
              </div>
            </div>
            <InternshipDesire
              v-show="internshipDesireFlag"
              ref="internshipDesire"
            />
          </section>
          <!-- 教育经历 -->
          <section class="block pt30">
            <div class="title">
              教育经历<span class="isRequire">*必填</span
              ><span class="en">Educaiton</span>
              <div
                class="add-btn"
                @click="editFun('educationalExperience')"
                v-if="
                  !educationalExperienceFlag && educationalExperience.length > 0
                "
              >
                + 添加教育经历
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('educationalExperience')"
              v-if="
                educationalExperience.length <= 0 && !educationalExperienceFlag
              "
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加教育经历 </el-col>
              </el-row>
            </div>
            <div class="word-record-item" v-if="!educationalExperienceFlag">
              <div
                class="educate"
                v-for="(item, index) in educationalExperience"
                :key="index"
              >
                <div class="row1">{{ item.schoolName }}</div>
                <span class="info">{{ item.educationalBackground }}</span>
                <span class="info">{{ item.major }}</span>
                <span class="info">
                  {{ ["无", "有"][item.diploma] }}学位证书</span
                >
                <span class="info">{{
                  item.intakeTime + "~" + item.graduateTime
                }}</span>
                <span class="info" v-if="item.graduateTime == '至今'">{{
                  "在读#" + getEducationOptions(item.grade)
                }}</span>
                <span class="info"
                  >{{ item.isOverseasStudy || "无" }}海外留学经历</span
                >
                <div
                  class="edit-btn"
                  type="text"
                  @click="editFun('educationalExperience', item, index)"
                >
                  <i class="edit-icon"></i> 编辑
                </div>
              </div>
            </div>
            <EducationalExperience
              v-show="educationalExperienceFlag"
              ref="educationalExperience"
            />
          </section>
          <!-- 工作/实习经历 -->
          <section class="block pt30">
            <div class="title">
              工作/实习经历<span class="en">Work Experience/Internship</span>
              <div
                class="add-btn"
                @click="editFun('workExperience')"
                v-if="!workExperienceFlag && workExperience.length > 0"
              >
                + 工作/实习经历
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('workExperience')"
              v-if="workExperience.length <= 0 && !workExperienceFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加工作/实习经历 </el-col>
              </el-row>
            </div>
            <div
              class="job-wish-item"
              v-for="(item, index) in workExperience"
              :key="index"
              v-if="!workExperienceFlag"
            >
              <div class="row1">{{ item.companyName }}</div>
              <div class="row4">
                <span class="value"
                  >{{ item.entryTime }}~{{ item.resignationTime }}</span
                >
              </div>
              <div class="row4">
                <span class="label">{{ item.jobName }}</span>
                <span class="value">{{ ["实习", "全职"][item.jobType] }}</span>
              </div>
              <div
                class="row4"
                v-if="item.jobDescription"
                v-html="item.jobDescription.replace(/\n/gm, '<br>')"
              ></div>
              <div
                class="edit-btn top0"
                type="text"
                @click="editFun('workExperience', item, index)"
              >
                <i class="edit-icon"></i> 编辑
              </div>
            </div>
            <WorkExperience v-show="workExperienceFlag" ref="workExperience" />
          </section>
          <!-- 项目经历 -->
          <section class="block pt30">
            <div class="title">
              项目经历<span class="en">Projects Experience</span>
              <div
                class="add-btn"
                @click="editFun('projectExperience')"
                v-if="!projectExperienceFlag && projectExperience.length > 0"
              >
                + 添加项目经历
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('projectExperience')"
              v-if="projectExperience.length <= 0 && !projectExperienceFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加项目经历 </el-col>
              </el-row>
            </div>
            <div
              class="job-wish-item"
              v-for="(item, index) in projectExperience"
              :key="index"
              v-if="!projectExperienceFlag"
            >
              <div class="row1">{{ item.projectName }}</div>
              <div class="row4">
                <span class="value">{{ item.beginTime }}~{{ item.endTime }}</span>
              </div>
              <div
                class="row4"
                v-if="item.projectDescription"
                v-html="item.projectDescription.replace(/\n/gm, '<br>')"
              ></div>
              <div
                class="edit-btn top0"
                type="text"
                @click="editFun('projectExperience', item, index)"
              >
                <i class="edit-icon"></i> 编辑
              </div>
            </div>
            <ProjectExperience
              v-show="projectExperienceFlag"
              ref="projectExperience"
            />
          </section>
          <!-- 语言能力 -->
          <section class="block pt30">
            <div class="title">
              语言能力<span class="en">Languages Level</span>
              <div
                class="add-btn"
                @click="editFun('languageAbility')"
                v-if="!languageAbilityFlag && languageAbility.length > 0"
              >
                + 添加语言能力
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('languageAbility')"
              v-if="languageAbility.length <= 0 && !languageAbilityFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加语言能力 </el-col>
              </el-row>
            </div>
            <div class="word-record-item" v-if="!languageAbilityFlag">
              <div
                class="educate"
                v-for="(item, index) in languageAbility"
                :key="index"
              >
                {{ item.languageName }}<span class="info">{{ item.level }}</span>
                <div
                  class="edit-btn"
                  type="text"
                  @click="editFun('languageAbility', item, index)"
                >
                  <i class="edit-icon"></i> 编辑
                </div>
              </div>
            </div>
            <LanguageAbility v-show="languageAbilityFlag" ref="languageAbility" />
          </section>
          <!-- 专业技能 -->
          <section class="block pt30">
            <div class="title">
              专业技能<span class="en">Skill</span>
              <div
                class="add-btn"
                @click="editFun('specialtyAbility')"
                v-if="!specialtyAbilityFlag && specialtyAbility.length > 0"
              >
                + 添加专业技能
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('specialtyAbility')"
              v-if="specialtyAbility.length <= 0 && !specialtyAbilityFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加专业技能 </el-col>
              </el-row>
            </div>
            <div class="word-record-item" v-if="!specialtyAbilityFlag">
              <div class="educate" v-for="(item, index) in specialtyAbility">
                {{ item.specialtyName }}<span class="info">{{ item.level }}</span>
                <div
                  class="edit-btn"
                  type="text"
                  @click="editFun('specialtyAbility', item, index)"
                >
                  <i class="edit-icon"></i> 编辑
                </div>
              </div>
            </div>
            <SpecialtyAbility
              v-show="specialtyAbilityFlag"
              ref="specialtyAbility"
            />
          </section>
          <!-- 证书 -->
          <section class="block pt30">
            <div class="title">
              证书<span class="en">Certification</span>
              <div
                class="add-btn"
                @click="editFun('certificates')"
                v-if="!certificatesFlag && certificates.length > 0"
              >
                + 添加证书
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('certificates')"
              v-if="certificates.length <= 0 && !certificatesFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加证书 </el-col>
              </el-row>
            </div>
            <div class="word-record-item" v-if="!certificatesFlag">
              <div class="educate" v-for="(item, index) in certificates">
                {{ item.certificatesName
                }}<span class="info">{{ item.time }}</span>
                <div
                  class="edit-btn"
                  type="text"
                  @click="editFun('certificates', item, index)"
                >
                  <i class="edit-icon"></i> 编辑
                </div>
              </div>
            </div>
            <Certificates v-show="certificatesFlag" ref="certificates" />
          </section>
          <!-- 已修课程 -->
          <section class="block pt30">
            <div class="title">
              已修课程<span class="en">Course Completed</span>
              <div
                class="add-btn"
                @click="editFun('courses')"
                v-if="!coursesFlag && courses.length > 0"
              >
                + 添加课程
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('courses')"
              v-if="courses.length <= 0 && !coursesFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加已修课程 </el-col>
              </el-row>
            </div>
            <div class="word-record-item" v-if="!coursesFlag">
              <div class="educate" v-for="(item, index) in courses">
                {{ item.coursesName }}<span class="info">{{ item.time }}</span>
                <div
                  class="edit-btn"
                  type="text"
                  @click="editFun('courses', item, index)"
                >
                  <i class="edit-icon"></i> 编辑
                </div>
              </div>
            </div>
            <Courses v-show="coursesFlag" ref="courses" />
          </section>
          <!-- 社会实践/活动经历 -->
          <section class="block pt30">
            <div class="title">
              社会实践/活动经历<span class="en">Social Practice</span>
              <div
                class="add-btn"
                @click="editFun('practiceExperience')"
                v-if="!practiceExperienceFlag && practiceExperience.length > 0"
              >
                + 添加社会实践/活动经历
              </div>
            </div>
            <div
              class="empty-btn"
              @click="editFun('practiceExperience')"
              v-if="practiceExperience.length <= 0 && !practiceExperienceFlag"
            >
              <el-row>
                <el-col> <i class="add-icon"></i>添加社会实践/活动经历 </el-col>
              </el-row>
            </div>
            <div
              class="job-wish-item"
              v-for="(item, index) in practiceExperience"
              :key="index"
              v-if="!practiceExperienceFlag"
            >
              <div class="row1">{{ item.practiceName }}</div>
              <div class="row4">
                <span class="value">{{ item.beginTime }}~{{ item.endTime }}</span>
              </div>
              <div
                class="row4"
                v-if="item.practiceDescription"
                v-html="item.practiceDescription.replace(/\n/gm, '<br>')"
              ></div>
              <div
                class="edit-btn top0"
                type="text"
                @click="editFun('practiceExperience', item, index)"
              >
                <i class="edit-icon"></i> 编辑
              </div>
            </div>
            <PracticeExperience
              v-show="practiceExperienceFlag"
              ref="practiceExperience"
            />
          </section>
        </el-form>
        <div class="btnRow">
          <div class="btns" @click="openReivew">预览简历</div>
          <div class="btns" @click="submitFun(false)">保存简历</div>
        </div>
      </section>
      <el-drawer
        title="简历预览"
        size="80%"
        :visible.sync="drawerDialog"
        direction="rtl"
        style="z-index: 99999"
        :append-to-body="true"
      >
        <ResumeReview :hideEdit="true" ref="ResumeReview" />
      </el-drawer>
    </PageCom>
    <TresumeEdit class="t_showview" :userInfo="userInfo"></TresumeEdit>
  </div>
 
</template>
<script>
import PageCom from "@/components/page/index.vue";
import { mapActions, mapState, mapMutations } from "vuex";
import { educationOptions } from "@/utils/frontDataDict.js";
import { getAge } from "../../utils/utils";
import {
  createStudentCurriculumVitae,
  updateStudentCurriculumVitae,
  getStudentCurriculumVitae,
  getStudentCurriculumVitaeBylogin,
  upUserInfo,
} from "../../request/api";
import InternshipDesire from "./components/internshipDesire.vue";
import EducationalExperience from "./components/educationalExperience.vue";
import WorkExperience from "./components/workExperience.vue";
import ProjectExperience from "./components/projectExperience.vue";
import LanguageAbility from "./components/languageAbility.vue";
import SpecialtyAbility from "./components/specialtyAbility.vue";
import Certificates from "./components/certificates.vue";
import Courses from "./components/courses.vue";
import PracticeExperience from "./components/practiceExperience.vue";
import ResumeReview from "./components/resumeReview.vue";
import SelectCom from "./components/selectCom.vue";
import TresumeEdit from "./TresumeEdit.vue";

export default {
  // 组件名称
  name: "resumeEdit",
  // 组件参数 接收来自父组件的数据
  props: {},

  // 局部注册的组件
  components: {
    ResumeReview,
    PageCom,
    InternshipDesire,
    EducationalExperience,
    WorkExperience,
    ProjectExperience,
    LanguageAbility,
    SpecialtyAbility,
    Certificates,
    Courses,
    PracticeExperience,
    SelectCom,
    TresumeEdit
  },
  // 组件状态值
  data() {
    return {
      drawerDialog: false,
      userInfo: {},
      jobStatusFrom: {
        jobStatus: null,
        inJobTime: null,
      },
      jobStatusFlag: false,
      internshipDesireFlag: false,
      educationalExperienceFlag: false,
      workExperienceFlag: false,
      projectExperienceFlag: false,
      languageAbilityFlag: false,
      specialtyAbilityFlag: false,
      certificatesFlag: false,
      coursesFlag: false,
      practiceExperienceFlag: false,
      name: "", //简历名称
      internshipDesire: [], //实习意向
      educationalExperience: [], //教育经历列表
      workExperience: [], //工作、实习经历列表
      projectExperience: [], //项目经历列表
      languageAbility: [], //语言能力列表
      specialtyAbility: [], //专业技能列表
      certificates: [], //证书列表
      courses: [], //已修课程列表
      practiceExperience: [], //实践经验
    };
  },
  computed: {
    ...mapState(["USER_INFO", "curriculumId"]),
  },
  watch: {
    USER_INFO: function (newValue, oldValue) {
      newValue.birthday && (newValue.age = getAge(newValue.birthday) + "岁");
      let { jobStatus, inJobTime } = newValue;
      // this.jobStatusFrom.jobStatus = jobStatus
      // this.jobStatusFrom.inJobTime = inJobTime
      this.userInfo = newValue;
    },
  },
  // 组件方法
  methods: {
    ...mapActions(["FETCH_USER_INFO"]),
    ...mapMutations(["setCurriculumId"]),
    // 通过抽屉查看简历预览
    openReivew() {
      let data = this.submitFun(true);
      if (!data) return;
      this.drawerDialog = true;
      setTimeout(() => {
        this.$refs.ResumeReview.open(data);
      });
    },
    openJobStatusEdit() {
      this.jobStatusFlag = true;
    },
    submitJobStatus() {
      if (!this.jobStatusFrom.jobStatus) {
        this.$message.error("请选择当前状态");
        return;
      }
      if (!this.jobStatusFrom.inJobTime) {
        this.$message.error("请选择入职时间");
        return;
      }
      this.userInfo.jobStatus = this.jobStatusFrom.jobStatus;
      this.userInfo.inJobTime = this.jobStatusFrom.inJobTime;
      upUserInfo(this.userInfo).then((res) => {
        if (res.code === 0 && res.data) {
          console.log(this.userInfo);
          this.jobStatusFlag = false;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    fetchJSON(str, key) {
      if (!str) return [];
      let arr = JSON.parse(str);
      if (arr.length <= 0) return [];
      this[key] = arr;
    },
    getEducationOptions(id) {
      let val = "";
      educationOptions.forEach((e) => {
        if (!e.children) return;
        let list = e.children.filter((v) => v.value == id);
        list.length > 0 && (val = list[0].label);
      });
      return val;
    },
    init() {
      let { id, index = 0 } = this.$route.query;
      if (!id) {
        this.name = `模板${index + 1}`;
        return;
      }
      getStudentCurriculumVitae({
        id,
      }).then((res) => {
        if (res.data) {
          this.fetchJSON(res.data.internshipDesire, "internshipDesire");
          res.data.educationalExperience.forEach((v) => {
            if (v.id) {
              delete v.id;
            }
          });
          this.name = res.data.name;
          this.educationalExperience = res.data.educationalExperience;
          this.fetchJSON(res.data.workExperience, "workExperience");
          this.fetchJSON(res.data.projectExperience, "projectExperience");
          this.fetchJSON(res.data.languageAbility, "languageAbility");
          this.fetchJSON(res.data.specialtyAbility, "specialtyAbility");
          this.fetchJSON(res.data.certificates, "certificates");
          this.fetchJSON(res.data.courses, "courses");
          this.fetchJSON(res.data.practiceExperience, "practiceExperience");
        } else {
        }
      });
    },
    linkTo(routeName) {
      this.$router.push({ name: routeName });
    },
    // 删除确认
    deleteConfirm(data) {
      console.log("删除确认>>>>", data);
    },
    // 城市切换
    handleCityChange(data) {
      console.log("期望城市>>>>", data);
    },
    handleOpen(dialogName) {
      this[dialogName] = true;
    },
    // 所属行业切换
    businessAreaChange(data) {
      console.log("data>>>>", data);
    },
    // 点击模块编辑，切换状态
    editModule(key) {
      this[key] = true;
    },
    editJobStatus() {
      this.jobStatusFlag = !this.jobStatusFlag;
    },
    editFun(key, item = {}, index = null) {
      this[`${key}Flag`] = true;
      if (JSON.stringify(index) != "null") {
        this.$refs[key].init(item, index);
      }
    },
    closeFun(key) {
      this[`${key}Flag`] = false;
    },
    deleteFun(key, index) {
      this[key].splice(index, 1);
    },
    upDate(key, data, index = null) {
      JSON.stringify(index) != "null"
        ? (this[key][index] = data)
        : this[key].push(data);
    },
    /**
     * 提交数据 / 预览数据
     * @param {Boolean} review 是否为预览模式 true 拿到预览的数据 fasle 提交
     */
    submitFun(review = false) {
      let {
        internshipDesire, //实习意向
        educationalExperience, //教育经历列表
        workExperience, //工作、实习经历列表
        projectExperience, //项目经历列表
        languageAbility, //语言能力列表
        specialtyAbility, //专业技能列表
        certificates, //证书列表
        courses, //已修课程列表
        practiceExperience, //实践经验
        name,
      } = this;
      if (!name) {
        this.$message.error("请填写简历名称");
        return false;
      }
      if (internshipDesire.length <= 0) {
        this.$message.error("请至少填写一项实习意向");
        return false;
      }
      if (educationalExperience.length <= 0) {
        this.$message.error("请至少填写一项教育经历");
        return false;
      }
      let {
        birthday,
        id,
        clan,
        email,
        liveCity,
        nickname,
        nativePlace,
        political,
        sex,
        studentPictureUrl,
        graduateTime,
        jobStatus,
        inJobTime,
        mobile,
      } = this.userInfo;
      let params = {
        birthday,
        clan,
        email,
        liveCity,
        nickname,
        nativePlace,
        political,
        jobStatus,
        inJobTime,
        sex,
        studentPictureUrl,
        graduateTime,
        mobile,
        studentId: id,
        name,
        studentName: nickname,
        publicStatus: "0",
        phoneNumber: mobile,
        identify: "student",
        internshipDesire: JSON.stringify(internshipDesire),
        educationalExperience: educationalExperience, //JSON.stringify(educationalExperience),
        workExperience: JSON.stringify(workExperience),
        projectExperience: JSON.stringify(projectExperience),
        languageAbility: JSON.stringify(languageAbility),
        specialtyAbility: JSON.stringify(specialtyAbility),
        certificates: JSON.stringify(certificates),
        courses: JSON.stringify(courses),
        practiceExperience: JSON.stringify(practiceExperience),
      };
      if (review) {
        return params;
      }
      if (!this.$route.query.id) {
        //没有简历id说明从没创建过简历，则走创建简历接口，否则走更新简历接口
        // setCurriculumId(666)
        createStudentCurriculumVitae(params).then((res) => {
          if (res.data) {
            //9489
            getStudentCurriculumVitaeBylogin().then((res) => {
              if (res.data) {
                this.$store.commit("setCurriculumId", res.data[0].id);
                this.$message({
                  message: "保存简历成功",
                  type: "success",
                });
                this.$router.replace({ name: "resumeReview" });
              }
            });
          } else {
            this.$message.error(res.msg);
          }
        });
      } else {
        params.id = this.$route.query.id;
        updateStudentCurriculumVitae(params).then((res) => {
          if (res.data) {
            //9489
            this.$message({
              message: "保存简历成功",
              type: "success",
            });
            this.$router.replace({ name: "resumeReview" });
          } else {
            this.$message.error(res.msg);
          }
        });
      }
    },
  },
  created() { },
  mounted() {
    this.init();
  },
  activated() {
    console.log('pc-activated')
    this.init();
  }
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.t_showview{
  display: none;
}
.resume-review {
  display: block;
  position: relative;
  width: 100%;
  background: #fff;
  // padding-bottom: 120px;
  .btnRow {
    width: 100%;
    // position: fixed;
    // left: 0;
    // bottom: 40px;
    display: flex;
    justify-content: center;
    height: 60px;
    z-index: 4;
    .btns {
      width: 260px;
      height: 52px;
      background: #4677b9;
      border-radius: 4px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 20px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #ffffff;
      line-height: 28px;
      cursor: pointer;
      &:first-child {
        margin-right: 60px;
      }
    }
  }
  .block {
    position: relative;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    margin-bottom: 20px;
  }
  .pt30 {
    padding: 20px;
  }
  .top0 {
    top: 0 !important;
    transform: translateY(0) !important;
  }
  .mb10 {
    margin-bottom: 10px;
  }
  .contact {
    .row1 {
      display: inline-block;
      text-align: left;
      font-size: 15px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #37383d;
      line-height: 21px;
      margin: 12px 0;
      span {
        margin: 10px;
      }
    }
  }
  .user-info {
    text-align: center;
    .touxiang {
      display: block;
      width: 90px;
      height: 90px;
      margin: 0 auto 12px;
    }
    .row1 {
      font-size: 24px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #37383d;
      line-height: 33px;
      margin-bottom: 10px;
    }
    .row2 {
      position: relative;
      display: inline-block;
      text-align: center;
      font-size: 15px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 21px;
      .line {
        position: relative;
        display: inline-block;
        width: 1px;
        height: 10px;
        background: #9597a0;
        margin: 0 13px;
      }
    }
  }
  .title {
    position: relative;
    font-size: 18px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #37383d;
    line-height: 25px;
    padding: 0;
    margin-bottom: 20px;
    .isRequire {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #fe4e3d;
      line-height: 20px;
      margin-left: 12px;
    }
    .en {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 20px;
      margin-left: 15px;
    }
  }
  .edit-btn {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 15px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #2f8efe;
    line-height: 21px;
    height: 21px;
    cursor: pointer;
    .edit-icon {
      display: inline-block;
      width: 15px;
      height: 16px;
      background: url("../../assets/images/edit_icon.png") no-repeat center
        center / cover;
      vertical-align: middle;
    }
  }
  .add-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #2f8efe;
    line-height: 27px;
    height: 27px;
    cursor: pointer;
    background: #3d6cb0;
    border-radius: 36px;
    color: #fff;
    padding: 0 15px;
  }
  .empty-btn {
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #2f8efe;
    line-height: 22px;
    text-align: center;
    .add-icon {
      display: inline-block;
      width: 14px;
      height: 14px;
      background: url("../../assets/images/add_icon.png") no-repeat center
        center / cover;
      margin-right: 15px;
    }
  }
  /deep/ .delete-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    display: inline-block;
    width: 25px;
    height: 25px;
    background: url("../../assets/images/delete_icon.png") no-repeat center
      center / cover;
  }
  /deep/ .el-button {
    width: 100px;
    height: 35px;
    line-height: 35px;
    padding: 0;
    text-align: center;
    background: #ffffff;
    border-radius: 3px;
    border: 1px solid #4677b9;
    font-size: 14px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #4677b9;
  }
  /deep/ .el-button--primary {
    color: #ffffff;
  }
  ::v-deep .el-form-item__label {
    line-height: 16px;
  }
  ::v-deep .left-label {
    .cn-label {
      font-size: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #37383d;
      line-height: 30px;
      margin-bottom: 2px;
    }
    .en-label {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 20px;
    }
  }
  .job-wish-item {
    position: relative;
    .row1 {
      font-size: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #37383d;
      line-height: 33px;
      margin-bottom: 15px;
      .line {
        position: relative;
        display: inline-block;
        width: 1px;
        height: 17px;
        background: #9597a0;
        margin: 0 25px;
      }
    }
    .row4 {
      margin-bottom: 10px;
      font-size: 18px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #37383d;
      line-height: 30px;
      word-break: break-all;
      display: flex;
      .row4_flex {
        width: 40%;
        word-break: break-all;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding-right: 10px;
      }
      .label {
        font-size: 16px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 28px;
        margin-right: 17px;
      }
      .value {
        font-size: 16px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #030303;
        line-height: 28px;
        margin-right: 130px;
      }
    }
  }
  .word-record-item {
    position: relative;
    margin-bottom: 30px;
    .educate {
      position: relative;
      font-size: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      padding-right: 100px;
      font-weight: 400;
      color: #37383d;
      line-height: 36px;
      padding-bottom: 27px;
      border-bottom: 1px solid #d4d6da;
      margin-bottom: 15px;
      &:last-child {
        border-bottom: 1px solid red;
        padding-bottom: 0;
      }
      .info {
        font-size: 16px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 36px;
        margin-right: 35px;
      }

      &:last-child {
        border-bottom: 1px solid #f9f9f9;
        margin-bottom: 0;
      }
    }
    .row1 {
      font-size: 20px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 28px;
      margin-bottom: 15px;
    }
    .row2 {
      font-size: 18px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #37383d;
      line-height: 33px;
      margin-bottom: 15px;
      span {
        font-size: 18px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #9597a0;
        line-height: 33px;
        margin-left: 218px;
      }
    }
    .row3 {
      font-size: 18px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 28px;
      margin-bottom: 15px;
      .line {
        position: relative;
        display: inline-block;
        width: 1px;
        height: 17px;
        background: #9597a0;
        margin: 0 25px;
      }
    }
    .row4 {
      margin-bottom: 20px;
      .label {
        font-size: 18px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 28px;
        margin-right: 17px;
      }
      .value {
        font-size: 18px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #030303;
        line-height: 28px;
        margin-right: 130px;
      }
    }
  }
}
/deep/ .el-breadcrumb__inner {
  font-size: 18px;
}
/deep/ .el-button--primary {
  background: #4677b9 !important;
  border: none;
}
@media screen and (max-width: 480px) {
  .t_showview{
    display: block;
  }
  .showview {
    display: none;
  }
}
</style>
